import Vue from 'vue'
import App from './App.vue'
import router from './router'

import './polyfill'
import 'mutationobserver-shim'
import 'promise-polyfill/src/polyfill'

import i18n from './i18n'
import { Carousel, CarouselItem, Dialog, Divider, Scrollbar, InfiniteScroll } from 'element-ui'

import Link from './components/Link'
import LanguageSwitch from './components/LanguageSwitch'
import HeaderNav from './components/HeaderNav'
import CarouselArrow from './components/CarouselArrow'
import Header from './components/Header'
import Footer from './components/Footer'
import IncreaseLayer from './components/IncreaseLayer'
import ContactUs from './components/ContactUs'

Vue.use(Carousel)
Vue.use(CarouselItem)
Vue.use(Dialog)
Vue.use(Divider)
Vue.use(Scrollbar)
Vue.use(InfiniteScroll)

Vue.component('app-link', Link)
Vue.component('language-switch', LanguageSwitch)
Vue.component('header-nav', HeaderNav)
Vue.component('carousel-arrow', CarouselArrow)
Vue.component('app-header', Header)
Vue.component('app-footer', Footer)
Vue.component('increase-layer', IncreaseLayer)
Vue.component('contact-us', ContactUs)

Vue.config.productionTip = false

new Vue({
  router,
  i18n,
  beforeCreate () {
    var IEReg = new RegExp('MSIE (\\d+\\.\\d+);')
    // 正则表达式匹配浏览器的userAgent字符串中MSIE后的数字部分，，这一步不可省略！！！
    let ieMatch = navigator.userAgent.match(IEReg)
    if (ieMatch) {
      var IEVersionNum = parseFloat(ieMatch[1])
      if (IEVersionNum === 9) {
        document.body.className = 'ie9-body'
      }
    }
  },
  render: h => h(App)
}).$mount('#app')
